import { defineStore } from 'pinia'
import { getLocal } from '@/utils/localStore'
export default defineStore('roleRoute', {
  state() {
    return {
      routeList: getLocal('roleRoute')
        ? JSON.parse(getLocal('roleRoute'))
        : ([] as Array<any>),
      registerRouteFresh: true,
    }
  },
  actions: {
    saveRoute(payLoad: any) {
      this.routeList = payLoad
    },
    deletRoute() {
      this.routeList = []
      this.registerRouteFresh = true
      console.log(this.registerRouteFresh, '重置路由了')
    },
    resetRoute() {
      this.registerRouteFresh = false
    },
  },
})
